<!-- 请复制整个jsp，修改下面第三行引用的js即可 -->
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/maintain/maintain_info_add.js"></script>

<style>
body {
	font-family: 'microsoft yahei';
}

em {
	font-style: normal;
	font-size: 14px;
}

.form-group {
	position: relative;
	width: 140px;
}

.form-group-txt {
	height: 32px;
	line-height: 32px;
	padding: 0 10px;
}

.form-group-select { /*padding-left: 1px;*/
	
}

.form-control, .simulation-input {
	width: 100%;
	line-height: 16px;
	font-size: 12px;
	color: #4b555b;
	background: none;
	outline: none;
	border: 1px solid #d3dcdd;
	background-color: #fff;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	-ms-box-sizing: border-box;
	box-sizing: border-box;
	margin: 0 -1px;
	padding: 7px 8px;
	*padding-left: 0;
	*padding-right: 0;
	*text-indent: 8px;
	*float: left;
	transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s
		ease-in-out 0s;
}
.w140{
width:250px;
}
.float-left {
	float: left;
}
#shebei{
	display:none;
}

#muju{
	display:none;
}

#last{
	display:none;
}
</style>
<body>
	<div class="contentPanel">
		<div class="m-b-md">
		<form id="form" name="form" class="form-horizontal" method="post"
		action="${pageContext.request.contextPath}/maintain/maintain_info_add.shtml">
		<section class="panel panel-default">
		<div class="panel-body">
			<div class="choose">
			<label>请选择维修种类</label>
				<div >
					<select  style="width:20%;" class="form-control" name="repairappFormMap.formCategoryId" readonly id="maintain">
						<option value="0" >----------请选择----------</option>	
						<option value="2" >----------设备维修----------</option>	
						<option value="1" >----------模具维修----------</option>		
					</select>
				</div>		
			</div>
			<div id="shebei">
					<lable>请输入设备编号:</lable>
					<input style="width: 10%;" type="text" id="shebeino" class="form-control" required name="repairappFormMap.equipmentNo"
					 placeholder="设备编号">
				</div>
				
				<div id="muju">
					<lable>请输入模具编号:</lable>
					<input type="text" class="form-control" id="moldno" required name="repairappFormMap.mouldNo"
					 placeholder="请输入模具编号">
				</div>
				
				<div id="last">
					<lable>请选择:</lable>
					<select style="width:20%;" id="cate" class="form-control" readonly name="repairappFormMap.sendOut">
						<option value="1" >----------本厂----------</option>	
						<option value="2" >----------发外----------</option>			
					</select>
					<lable>异常原因:</lable>
					<textarea name="repairappFormMap.reason" id="reason" rows="10" cols="20" class="form-control"></textarea>
					<footer class="panel-footer text-right bg-light lter">
						<button type="submit" class="btn btn-success btn-s-xs">确定</button>
					</footer>
				</div>
		</div>
		</section>
		</form>
		</div>
	</div>
<script type="text/javascript">
$(function(){
	$("#maintain").change(function(){
		var clicked=$(this).val();
		if(clicked==2){
			$("#shebei").show(500);
			$("#muju").hide();
			$("#moldno").val(" ");
		}else if(clicked==1){
			$("#shebei").hide();
			$("#muju").show(500);
			$("#shebeino").val(" ");
		}else{
			$("#muju").hide();
			$("#shebei").hide();
			$("#moldno").val(" ");
			$("#shebeino").val(" ");
			$("#last").hide();
			$("#reason").val("");
		}
	});
	$("#cate").change(function(){
		var shebeino=$("#shebeino").val();
		$.get(rootPath+"/maintain/shebeiIfExict.shtml?shebei="+shebeino,function(data){
			if(eval(data)=="false"){
				alert("此设备编号不存在!");
				$("#last").hide(500);
			}else{
				$("#last").show(500);
			}
		});
	});
	$("#shebeino").change(function(){
		var shebeino=$(this).val();
		$.get(rootPath+"/maintain/shebeiIfExict.shtml?shebei="+shebeino,function(data){
			if(eval(data)=="false"){
				alert("此设备编号不存在!");
				$("#last").hide(500);
			}else{
				$("#last").show(500);
			}
		});
	});
	$("#moldno").change(function(){
		var moldno=$(this).val();
		$.get(rootPath+"/maintain/moldIfExict.shtml?mold="+moldno,function(data){
			if(eval(data)=="false"){
				alert("此模具编号不存在!");
				$("#last").hide(500);
			}else{
				$("#last").show(500);
			}
		});
	});
});

</script>
</body>